package com.gdlt.mq2db;

import java.io.InputStream;

import org.apache.hadoop.conf.Configuration;

/**
 * Created by CM on 2017/3/14.
 *
 */

public class Kafka2pgConfig {
	// 1. Configuration 对象是可以直接实例化的
	static Configuration conf = new Configuration(false);
	public static String TOPIC_CONF_NAME = "kafka2pg.kafka.topic";
	public static String TOPIC_DEFAULT_VALUE = "golia";

	public static String SERVERS_CONF_NAME = "kafka2pg.kafka.bootstrap.servers";
	public static String SERVERS_DEFAULT_VALUE = "";

	public static String GROUP_ID_CONF_NAME = "kafka2pg.kafka.group.id";
	public static String GROUP_ID_DEFAULT_VALUE = "";
	
	public static String BATCHSIZE_CONF_NAME = "kafka2pg.kafka.batchsize";
	public static String TIMEOUT_CONF_NAME = "kafka2pg.kafka.timeout";

	public static String KEY_DESER_CONF_NAME = "kafka2pg.kafka.key.deserializer";
	public static String VALUE_DESER_CONF_NAME = "kafka2pg.kafka.value.deserializer";

	public static String PG_URL_CONF_NAME = "kafka2pg.pg.url";
	public static String PG_USER_CONF_NAME = "kafka2pg.pg.user";
	public static String PG_PASSWORD_CONF_NAME = "kafka2pg.pg.password";
	public static String PG_DRIVER_CONF_NAME = "kafka2pg.pg.driver";

	public static String WRITER_CLASSES= "writer.classes";
	public static String OFFSET_CLASS = "offset.class";
	public static String GRAPHITE_HOST = "graphite_host";
	public static String GRAPHITE_HOST_DEFAULT_VALUE = "127.0.0.1";
	public static String GRAPHITE_PORT = "graphite_port";
	public static int GRAPHITE_PORT_DEFAULT_VALUE = 2007;

	public static void AddConfig(InputStream inputStream) {
		// 2. 通过调用 addResource 方法来将配置资源注册到 Configuration
		// 对象中，这个时候 Configuration 对象内还没有加载配置中的内容
		if (inputStream != null) {
			conf.addResource(inputStream);
		}
	}

	public static Configuration getConf() {
		return conf;
	}

}
